using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;

public partial class site : System.Web.UI.MasterPage
{
    //public string CurrentUrl = "";

    protected void Page_Load(object sender, EventArgs e)
    {
    //    if (Page.User.Identity.IsAuthenticated)
    //    {
    //        aLogin.InnerText = Resources.labels.logoff;
    //        aLogin.HRef = BlogEngine.Core.Utils.RelativeWebRoot + "login.aspx?logoff";
    //    }
    //    else
    //    {
    //        aLogin.HRef = BlogEngine.Core.Utils.RelativeWebRoot + "login.aspx";
    //        aLogin.InnerText = Resources.labels.login;
    //    }

    //    CurrentUrl = Request.RawUrl.ToLower().Remove(0, Request.RawUrl.LastIndexOf("/") + 1).Replace(".aspx", "");
    //    DataBind();

    //    if (Request.QueryString.Count == 0 && Request.RawUrl.Replace("?", "").EndsWith("/default.aspx", StringComparison.OrdinalIgnoreCase))
    //    {
    //        string query = Request.QueryString["theme"];
    //        string theme = !string.IsNullOrEmpty(query) ? query : BlogSettings.Instance.Theme;
    //        string path = string.Concat(Utils.RelativeWebRoot, "themes/", theme, "/PostViewFrontPage.ascx");
    //        //Control.MapPath() 

    //        PostViewBase postView = (BlogEngine.Core.Web.Controls.PostViewBase)LoadControl(path);
    //        postView.ShowExcerpt = true;// BlogSettings.Instance.ShowDescriptionInPostList;
    //        //just set a temp post to show - for not getting error
    //        Post tmp = BlogEngine.Core.Post.Posts[0];
    //        postView.Post = tmp;
    //        postView.ID = "sdfsdfsf";// tmp.Id.ToString().Replace("-", string.Empty);
    //        postView.Location = ServingLocation.PostList;

    //        fronttop.Controls.Add(postView);
    //    }

    //    Control postList =FindControlById(this.Page, "PostList1");

    //    if (postList != null)
    //    {
    //        postList.Visible = false;
    //    }
        
    //}

    //private Control FindControlById(Control root, string id)
    //{
    //    if (id == string.Empty)
    //        return null;

    //    if (root.ID == id)
    //        return root;

    //    foreach (Control c in root.Controls)
    //    {
    //        Control t = FindControlById(c, id);
    //        if (t != null)
    //        {
    //            return t;
    //        }
    //    }
    //    return null;
   }

}
